package com.qqcy.loginservice.controller;

import com.qqcy.loginservice.pojo.User;
import com.qqcy.loginservice.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * DATE: 2022/1/10
 * Author: huhuan
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @Value("${server.port}")
    private String port;

    @RequestMapping("/findById/{uid}")
    public User findById(@PathVariable("uid") Integer uid){
        System.out.println("调用的是login服务，端口号为："+port);
        return userService.findById(uid);
    }

    @RequestMapping(value = "/userList",method = RequestMethod.GET)
    public List<User> getUserList(){
        return userService.findAllUser();
    }

}
